package com.lovetemperature.action;

import java.util.List;

import com.lovetemperature.model.Staff;
import com.lovetemperature.service.ShopService;
import com.lovetemperature.service.StaffService;
import com.opensymphony.xwork2.ActionSupport;

public class StaffAction extends ActionSupport {
	private StaffService staffService;
	private ShopService shopService;
	private List<Staff> staffList;
	private String shopId;
	private boolean editOneShopStaffs;
	
	public String show(){
		if(shopId!=null && !shopId.equalsIgnoreCase("")){	//查看某一店铺的员工
			editOneShopStaffs = true;
			staffList = shopService.findById(new Long(shopId)).getStaffList();
		}else{	//查看所有的员工
			editOneShopStaffs = false;
			staffList = staffService.findAllStaff();
		}
		shopId = null;
		return "success";
	}
	
	public StaffService getStaffService() {
		return staffService;
	}

	public void setStaffService(StaffService staffService) {
		this.staffService = staffService;
	}

	public List<Staff> getStaffList() {
		return staffList;
	}

	public void setStaffList(List<Staff> staffList) {
		this.staffList = staffList;
	}

	public ShopService getShopService() {
		return shopService;
	}

	public void setShopService(ShopService shopService) {
		this.shopService = shopService;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public boolean isEditOneShopStaffs() {
		return editOneShopStaffs;
	}

	public void setEditOneShopStaffs(boolean editOneShopStaffs) {
		this.editOneShopStaffs = editOneShopStaffs;
	}
}
